﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Web.UI;

#region Assembly Resource Attribute

[assembly: WebResource("AjaxControlToolkit.TimerExtender.TimerExtenderBehavior.js", "application/x-javascript")]

#endregion Assembly Resource Attribute

namespace AjaxControlToolkit
{
    /// <summary>
    /// TimerExtender control.
    /// Used to control a Timer control.
    /// </summary>
    [Designer("AjaxControlToolkit.TimerExtender, AjaxControlToolkit")]
    [TargetControlType(typeof(Timer))]
    [RequiredScript(typeof(CommonToolkitScripts))]
    [ClientScriptResource("AjaxControlToolkit.TimerExtenderBehavior", "AjaxControlToolkit.TimerExtender.TimerExtenderBehavior.js")]
    [System.Drawing.ToolboxBitmap(typeof(TimerExtender), "TimerExtender.TimerExtender.ico")]
    public class TimerExtender : ExtenderControlBase
    {

        /// <summary>
        /// Determines if the timer is reset on mouse action
        /// </summary>
        [ExtenderControlProperty]
        [DefaultValue("true")]
        [ClientPropertyName("resetOnMouseAction")]
        public Boolean ResetOnMouseAction
        {
            get { return (Boolean)GetPropertyValue("ResetOnMouseAction", true); }
            set { SetPropertyValue("ResetOnMouseAction", value); }
        }

        /// <summary>
        /// Determines if the timer is reset on key press
        /// </summary>
        [ExtenderControlProperty]
        [DefaultValue("false")]
        [ClientPropertyName("resetOnKeyPress")]
        public Boolean ResetOnKeyPress
        {
            get { return (Boolean)GetPropertyValue("ResetOnKeyPress", false); }
            set { SetPropertyValue("ResetOnKeyPress", value); }
        }

        /// <summary>
        /// Javascript function raised on client at tickevent
        /// </summary>
        [ExtenderControlEvent]
        [Category("Behavior")]
        [DefaultValue("")]
        [ClientPropertyName("clientTick")]
        public string OnClientTick
        {
            get { return GetPropertyValue("OnClientTick", ""); }
            set { SetPropertyValue("OnClientTick", value); }
        }
    }
}
